package com.lee.config.interceptor;

import org.apache.kafka.clients.producer.ProducerInterceptor;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * @Description TODO
 * @Author winston
 * @DateTime 2021/11/27
 */
public class TmeInterceptor implements ProducerInterceptor<String, String> {
	@Override
	public ProducerRecord<String, String> onSend(ProducerRecord<String, String> record) {
		String message = LocalDateTime.now().toString()+","+record.value();
		return new ProducerRecord<>(record.topic(),record.partition(), record.key(), message);
	}

	@Override
	public void onAcknowledgement(RecordMetadata metadata, Exception exception) {

	}

	@Override
	public void close() {

	}

	@Override
	public void configure(Map<String, ?> configs) {

	}
}
